xquery version "1.0";

for $port in doc("airport.xml")/airport_list/airport

for $line in doc("airline.xml")/
airline_list/airline

let $newport  := $port/name

where $port/id = $line/AIRLINE_ID

order by $line/flightNumber

return( $newport, $port/airportdesc/ORIGIN_CITY_NAME,$line/DESTINATION)